package com.leilei;

import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;
/**
 * @author: lei
 * @date: 2024-07-18 11:10
 * @desc: 配置 这里必须继承WebMvcConfigurationSupport不实现WebMvcConfigurer,避免ms-interceptor扫包handleClass无法加入自定义参数解析器
 */
public class WebConfiguration implements WebMvcConfigurer {

    private final SecretProperties secretProperties;

    public WebConfiguration(SecretProperties secretProperties) {
        this.secretProperties = secretProperties;
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        resolvers.add(new DecryptBodyArgumentResolver(secretProperties));
    }
}
